package com.wn.controller;

import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.wn.api.MemberApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Member;

/**
 * @author yellow Docter
 * @date 2023 -03-10
 * @desc
 */
@RestController
@RequestMapping("/portal")
//@DefaultProperties(defaultFallback = "errorFallback")
public class PortalController {

    @Autowired
    private MemberApi memberApi;

    @GetMapping("/{id}")
    @HystrixCommand           // 熔断降级注解
    public String findMemberById(@PathVariable Integer id){
        return  memberApi.findMemberById(id);
    }

//    //服务降级的方法
//    public String errorFallback(){
//        return "feign 执行异常.走默认方法....";
//    }

}